package com.onpositive.properties.editor.model;

import java.util.ArrayList;

public class PropertyModel {
	
	private String name;
	
	private int count;
	
	private ArrayList<ParserData> parserDataArray;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public ArrayList<ParserData> getParserDataArray() {
		return parserDataArray;
	}

	public void setParserDataArray(ArrayList<ParserData> parserDataArray) {
		this.parserDataArray = parserDataArray;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}
	
	@Override
	public String toString() {
		StringBuilder bld = new StringBuilder("Property: ");
		bld.append(name != null ? name : "null");
		bld.append(": " + count);
		String result = bld.toString();
		return result;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + count;
		result = prime * result
				+ ((parserDataArray == null) ? 0 : parserDataArray.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PropertyModel other = (PropertyModel) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (count != other.count)
			return false;
		if (parserDataArray == null) {
			if (other.parserDataArray != null)
				return false;
		} else if (!parserDataArray.equals(other.parserDataArray))
			return false;
		return true;
	}
}
